﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BluSteamServer.Model
{
    public class LogoutCommand : Command
    {
        private readonly string _username;

        public LogoutCommand(string username)
        {
            _username = username;
        }

        public void Execute()
        {
            // remove user from the ConnectionManager
            ConnectionManager.Instance.RemoveConnection(_username);

            // notify client that logout was successful
            string message = string.Format("$CP2011~{0}~RESPONSE~LOGOUT_SUCCESS", _username);
            Network.Send(_username, message);
        }
    }
}
